Xbasic

SQL_TableExport Function

Syntax

Result_Flag as L = SQL_TableExport(P sqlconn ,L createTable ,* sourcedbf_or_pointer ,C owner ,C table , ResultMessage [,C filter [,C order [,C queryflags [,C ExportFieldList [,* arguments [,C CreateStatement [,L ShowProgress [,L AllowCancel [,C StatusBarFormatString [,C argumentDefinitions [,C autonumberField [,C identityFields [,* opsPassedIn ]]]]]]]]]]]]])

Arguments

Result_Flag

TRUE (.T.) if the operation was successful; otherwise FALSE (.F.).

sqlconn

A SQL::Connection object.

createTable

Logical. .T. = Create a new table.

sourcedbf_or_pointer

The path to and name of the Alpha Anywhere table to export.

owner

The owner of the back-end database.

table

The name of the table to create in the back-end database.

ResultMessage

A character variable that will receive any error message.

filter

Default = "" (all records). A logical expression that selects the records to export.

order

Default = "" (record number order). A character expression that orders the exported records.

queryflags

Default = "". Refer to Query Options.

ExportFieldList

Default = "". Either a simple list of CR-LF or comma delimited fields or a list of fields AND expressions. If the ExportFieldList contains expressions, then it must be CR-LF delimited.

arguments

Default = NULL_VALUE(). Values used in the filter or order expressions. These values may come from variables or from user input at run time.

CreateStatement

Default = "". A SQL CREATE TABLE statement.

ShowProgress

Logical. Default = .T. Indicates whether to display a progress bar.

AllowCancel

Logical. Default = .T. Indicates whether the progress bar contains a cancel button.

StatusBarFormatString

Default = "". The formatting string that defines the appearance of the progress bar.

argumentDefinitions

Character

autonumberField

Character

identityFields

Character

opsPassedIn

*

Description

Export a local table to a backend SQL database.

Discussion

The SQL_TableExport() function exports an Alpha Anywhere table to a back-end database.

Example

dim fieldlist as C
dim tblPointer as P
dim cn as sql::connection
dim message as C

fieldlist = <<%txt%
fullname = ut(firstname) + ", " + ut(lastname)
lastname
firstname = upper(firstname)
date = date()
number = 123*23
%txt%

tblPointer = table.OpenMap("customer",fieldlist)
flag = cn.open("{A5API=Excel,FileName='c:\customer_alphadao.xls'}")
if flag = .f. then
    ui_msg_box("Error",cn.CallResult.text)
    end 
end if 
 
flag = sql_tableexport(cn,.f.,tblPointer,"","Customer",message)

Limitations

Desktop applications only.

See Also